<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			var a = 5
			var b = '5'
			console.log(a == b) // true，比较内容，不区分数据类型
			console.log(a === b) // false，比较类型和内容
			var c = 1
			console.log(c == true) // true:1,false:0。结果:true
			console.log(false == 'false') // false
			
			var x = '2'
			console.log(2 == '2') // true
			// switch是根据===来判断case的
			switch (x){
				case 1:
					console.log('abc')
					break
				case 2:
					console.log('def')
					break
				default:
					console.log('xyz')
					break
			}
			/* 三元运算符：2个结果类型可以不一致 */
			var d = 3 <= false ? 'abc' : {name:'张三', age: 20}
			console.log(d)
			console.log(typeof d)
			
			/* 选择排序：升序 */
			var arr = [5, 6, 8, 2, 3];
			for(var i = 0; i < arr.length - 1; i++){
				for(var j = i; j < arr.length; j++){
					if(arr[i] > arr[j]){
						var temp = arr[i]
						arr[i] = arr[j]
						arr[j] = temp
					}
				}
			}
			console.log(arr)
			
		</script>
	</head>
	<body>
	</body>
</html>